<script setup>
  import {
    computed, reactive, ref, defineExpose
  } from "vue";


  const _visible = ref(false);
  let _operType = ref("add");
  let _formData = reactive({});

  const open = function({ operType, data }) {
    _operType.value = operType;
    _formData = data;
    _visible.value = true;
  }

  const close = function(done) {
    _visible.value = false;
    done();
  }

  // 对外暴露
  defineExpose({
    open,
  });

  const _title = computed(()=> (_operType.value === "add" ? "Add" : "Edit") + "Content");
</script>

<template>
  <el-dialog :title="_title" v-model="_visible" :before-close="close">
    Test Content {{ _operType }} {{ _formData }} 
  </el-dialog>
</template>

<style scoped lang="scss"></style>